package com.lsmo.android.carfans.view.favorites;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lsmo.android.carfans.R;
import com.lsmo.android.carfans.model.favorites.FavoritesThread;

public class FavoritesModelListItemLayout extends LinearLayout {

	private ImageView mImageView;
	private TextView mNameText;
	private TextView mPriceText;

	public FavoritesModelListItemLayout(Context context) {
		super(context);

		((LayoutInflater) context
				.getSystemService(Activity.LAYOUT_INFLATER_SERVICE)).inflate(
				R.layout.favorites_model_item_layout, this);

		mImageView = (ImageView) this
				.findViewById(R.id.favorites_model_listView_item_imageView);
		mNameText = (TextView) this
				.findViewById(R.id.favorites_model_listView_item_name);
		mPriceText = (TextView) this
				.findViewById(R.id.favorites_model_listView_item_price);
	}

	public void updateView(FavoritesThread.CarModel cm) {
		this.mImageView.setBackgroundResource(R.drawable.forum_thread_icon);
		this.mNameText.setText(cm.getName());
		this.mPriceText.setText(cm.distributorPriceRange);
	}
}